package org.iblink.gui.swing.frames;

import java.awt.Dimension;
import java.awt.GridLayout;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JSplitPane;

import org.iblink.gui.swing.views.AssetBrowser;
import org.iblink.gui.swing.views.CategoryTree;
import org.iblink.gui.swing.views.component.IBlinkMenuBar;

/**
 * Main frame for ;Blink application
 * 
 * @author tpares
 *
 */
public class IBlinkFrame extends JFrame {

  /**
   * Generated serial version UID
   */
  private static final long serialVersionUID = 396072004464700804L;

  /**
   * Frame constructor
   */
  public IBlinkFrame(){
    super();
    
    build();
  }
  
  /**
   * Builds the frame
   */
  private void build(){
    setTitle(";Blink");
    setSize(640,320);
    setLocationRelativeTo(null);
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    setJMenuBar(new IBlinkMenuBar());
    setContentPane(buildContentPane());
  }
  
  /**
   * The the frame's content pane.
   * 
   * @return the content pane
   */
  private JPanel buildContentPane() {
    JPanel panel = new JPanel(new GridLayout(1,0));
    
    JScrollPane treeView = new JScrollPane(new CategoryTree());
    treeView.setPreferredSize(new Dimension(200, 10));
    
    JScrollPane browserView = new JScrollPane(new AssetBrowser());
    
    JSplitPane split = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
    split.setLeftComponent(treeView);
    split.setRightComponent(browserView);
    
    panel.add(split);
    
    return panel;
  }
}
